Skip to content

Update benchmarks #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 18, 2020
Merged

Update benchmarks #103

merged 5 commits into from
Oct 18, 2020

Conversation

thomashoneyman
Copy link
Member

@thomashoneyman thomashoneyman commented Oct 11, 2020

This PR updates the benchmarks so they can be run on the current (v5.2.0) and previous (v0.6.1) implementations. The old (v0.6.1) implementation suffers from a stack overflow in the left-bind benchmark, so for the time being I've simply disabled it. Open to suggestions if anyone knows how to fix that!

This PR supersedes #88. It also includes commands in the package.json file to build and run the benchmarks. Finally, it compiles (but does not run) the benchmarks as part of CI, just so they don't get so horribly out of date again in the future.

As part of this change, I've moved the current v5.2.0 implementation of Free / Trampoline into the benchmarks directory. That way we can use it as a reference when testing any future performance changes, as we're not exactly going to return to the v0.6.1 design -- v5.2.0 is a better reference for future benchmarks.

This PR is a first step towards testing a new implementation for Free which is significantly faster in the Halogen Hooks benchmarks:
thomashoneyman/purescript-halogen-hooks#61

Also closes #47.

@@ -0,0 +1,245 @@
module Benchmark.Free326759a
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a direct copy/paste of the v5.2.0 Control.Monad.Free module.

-- | A _trampoline_ monad, which can be used at the bottom of
-- | a monad transformer stack to avoid stack overflows in large
-- | monadic computations.
module Benchmark.Trampoline326759a
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a copy/paste of the v5.2.0 Control.Monad.Trampoline module.

Comment on lines 6 to 7
import Benchmark.Trampoline0df59c5 as Trampoline0df59c5
import Benchmark.Trampoline326759a as Trampoline326759a
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it easier to tell what code came from what module by qualifying both of them with their commit, instead of only qualifying the old v0.6.1 code.

@thomashoneyman
Copy link
Member Author

These are the charts generated with https://harry.garrood.me/purescript-benchotron-svg-renderer for the four benchmarks. The left-bind benchmark with large inputs doesn't contain the v0.6.1 code because it has a stack overflow.

right-bind-small

right-bind-large

left-bind-small
left-bind-large

@thomashoneyman
Copy link
Member Author

(@safareli -- as you worked on #88, do you have any comments on this?)

@safareli
Copy link
Contributor

Unfortunately I can't review this as I'm busy for this month. Thanks for working on this tho!

@thomashoneyman
Copy link
Member Author

Unless a maintainer objects, I'll go ahead and merge this within the next few days given that it doesn't affect the library internals and re-enables a very useful set of benchmarks. The disabled test can be re-enabled in the future if necessary.

@garyb
Copy link
Member

garyb commented Oct 17, 2020

Sounds good to me

@thomashoneyman thomashoneyman merged commit d45e652 into purescript:master Oct 18, 2020
@thomashoneyman thomashoneyman deleted the benchmarks branch August 11, 2021 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reinstate benchotron usage
3 participants